home *** CD-ROM | disk | FTP | other *** search
/ MacPeople 1998 #2 / MACPEOPLE-1998-NO2.ISO / アップル関連 / ARA PS アップデート / モデム用追加分 / aiwa PV-AFV144⁄M2 for 2.1 / aiwa PV-AFV144_M2 for 2.1 next >
Text File  |  1996-06-26  |  10KB  |  513 lines

  1. !  for AIWA PV-AFV144
  2. !           PV-AFV144M2
  3. !
  4. !    Copyright:     1991-1996 Apple Computer, Inc.    All Rights Reserved.
  5. !
  6. !    revision history:
  7. !        v2.1    as shipped with the ARA 2.1
  8. !
  9. !  'mlts' resource info for this modem:
  10. !    byte 1 == 01 -> modem HAS built-in error correction protocols
  11. !    byte 2 == 01 -> modem HAS built-in data compression protocols
  12. !    byte 3 == 200 -> max number of chars in varstr 7
  13. !    byte 4 == 200 -> max number of chars in varstr 8
  14. !    byte 5 == 200 -> max number of chars in varstr 9
  15. !    
  16. @ORIGINATE
  17. @ANSWER
  18. !
  19. ! ---- Initial modem setup ----
  20. !
  21. ! Set serial port speed depending upon the compression flag
  22. !    A higher rate with compression on to handle expanded data from the modem
  23. !    A lower rate closer to the DCE when compression is off
  24. ifstr 5 1 "0"
  25. serreset 57600, 0, 8, 1
  26. jump 2
  27. !
  28. @LABEL 1
  29. serreset 38400, 0, 8, 1
  30. @LABEL 2
  31. hsreset 0 0 0 0 0 0
  32. settries 0
  33. !
  34. ! Get the modem's attention
  35. !
  36. matchclr
  37. matchstr 1 3 "OK¥13¥10"
  38. write "AT¥13"
  39. matchread 30
  40. !
  41. @LABEL 3
  42. !
  43. ! Setup the modem for the following:
  44. !   Reset to factory settings
  45. !   Standard compression/reliablity
  46. !   Lock serial port speed
  47. !   Serial port hardware handshaking, turn off software handshaking
  48. !   Verbose responces and compresion/protocol results
  49. !   CONNECT returns DCE speed
  50. !   Turn off answering
  51. !   Reset or return to command mode on DTR toggle (optional)
  52. !
  53. matchclr
  54. matchstr 1 4 "OK¥13¥10"
  55. write "ATE0Q0¥¥V2&C1&M5¥¥J0¥¥Q3&D0%C1M1¥13"
  56. matchread 30
  57. inctries
  58. iftries 3 101
  59. !
  60. ! Reset the Modem on setup failure
  61. !
  62. DTRClear
  63. pause 5
  64. DTRSet
  65. flush
  66. jump 3
  67. !
  68. !
  69. @LABEL 4
  70. ! Varstring 4 , reliable link protocol:
  71. !    = 0, handled by computer (ARAP)
  72. !    = 1, handled by modem (PPP)
  73. !    = 2, MNP10 protocol (Cellular protocol, no longer supported)
  74. ifstr 4 5 "1"
  75. ifstr 4 5 "2"
  76. !
  77. ! Varstring 4 == 0, turn off reliable link protocol in modem (ARAP)
  78. matchclr
  79. matchstr 1 9 "OK¥13¥10"
  80. write "AT&M0¥13"
  81. matchread 30
  82. jump 101
  83. !
  84. !
  85. @LABEL 5
  86. ! Varstring 5, compression protocol:
  87. !    = 0, handled by computer 
  88. !    = 1, handled by modem
  89. ifstr 5 9 "1"
  90. !
  91. ! Varstring 5 == 0, turn off compression protocol in modem.
  92. matchclr
  93. matchstr 1 9 "OK¥13¥10"
  94. write "AT%C0¥13"
  95. matchread 30
  96. jump 101
  97. !
  98. !
  99. @LABEL 9
  100. ! Varstring 2, modem speaker:
  101. !    = 0, speaker off
  102. !    = 1, speaker on
  103. ifstr 2 13 "1"
  104. pause 5
  105. matchclr
  106. matchstr 1 13 "OK¥13¥10"
  107. write "ATM0¥13"
  108. matchread 30
  109. jump 101
  110. !
  111. ! Modem ready, wait for a call or originate a call
  112. !
  113. @LABEL 13
  114. ifANSWER 32
  115. !
  116. !
  117. ! ---- Originating a call ----
  118. !
  119. ! Varstring 6, dialing mode:
  120. !    = 0, normal dialing
  121. !    = 1, blind dialing
  122. !    = 2, manual dialing
  123. ifstr 6 17 "1"
  124. ifstr 6 15 "2"
  125. jump 19
  126. !
  127. @LABEL 15
  128. note "Manual dialing initiated" 3
  129. ! Display ASK dialog with message.  Goto label 107 if dialog canceled.
  130. ASK 0 "Pick up the phone & dial ^1.  Hit OK when the phone rings, then hangup." 107
  131. ! X1 to ignore dialtone & busy, D to dial, ¥^ generates data tone
  132. write "ATX1D¥^¥13"
  133. jump 32
  134. !
  135. @LABEL 17
  136. note "Dialing without tone" 3
  137. matchclr
  138. matchstr 1 19 "OK¥13¥10"
  139. ! X1 to ignore dialtone & busy
  140. write "ATX1¥13"
  141. matchread 30
  142. jump 101
  143. !
  144. !
  145. @LABEL 19
  146. ! Display the full dialstring contained in Varstring 1
  147. note "Dialing ^1" 3
  148. !
  149. ! Varstrings 7, 8 and 9, contain dialstring fragments
  150. !    Long phone numbers may need to be split into smaller groups
  151. !    for the modem to use
  152. !
  153. ! Varstring 3:  "p" for pulse & "t" for tone dialing
  154. ! Varstring 8 == blank (dialstring in varstring 7)
  155. ! Varstring 9 == blank (dialstring in varstrings 7 & 8)
  156. ! Otherwise (dialstring in varstrings 7, 8 & 9)
  157. ! ¥^ is added to the dialstring to force the modem to generate a data tone
  158. ifstr 8 27 " "
  159. ifstr 9 24 " "
  160. !
  161. !  Write dialstring in varstrings 7, 8 & 9
  162. matchclr
  163. matchstr 1 21 "OK¥13¥10"
  164. write "ATD^3¥^^7;¥13"
  165. matchread 400
  166. jump 101
  167.  
  168. @LABEL 21
  169. matchclr
  170. matchstr 1 22 "OK¥13¥10"
  171. write "ATD^3^8;¥13"
  172. matchread 400
  173. jump 101
  174.  
  175. @LABEL 22
  176. write "ATD^3^9¥13"
  177. jump 32
  178. !
  179. !
  180. @LABEL 24
  181. !  Write dialstring in varstrings 7 & 8
  182. matchclr
  183. matchstr 1 25 "OK¥13¥10"
  184. write "ATD^3¥^^7;¥13"
  185. matchread 400
  186. jump 101
  187.  
  188. @LABEL 25
  189. write "ATD^3^8¥13"
  190. jump 32
  191. !
  192. @LABEL 27
  193. !  Write dialstring in varstring 7
  194. write "ATD^3¥^^7¥13"
  195. !
  196. !
  197. !    ---- Connection responce ----
  198. !
  199. ! The following section will parse modem responces of two types:
  200. !   1) PROTOCOL: xxx, COMPRESSION: xxx, CONNECT xxx
  201. !   2) CONNECT xxx/ARQ/V42
  202. !
  203. @LABEL 32
  204. matchclr
  205. matchstr  1 81  "RING¥13¥10"
  206. matchstr  2 102 "NO DIALTONE¥13¥10"
  207. matchstr  3 103 "NO CARRIER"
  208. matchstr  4 103 "ERROR¥13¥10"
  209. matchstr  5 104 "BUSY¥13¥10"
  210. matchstr  6 105 "NO ANSWER¥13¥10"
  211. matchstr  7 33  "CONNECT "
  212. matchstr  8 32  "CARRIER"
  213. matchstr  9 40  "CONNECT¥13¥10"
  214. matchstr 10 62  "PROTOCOL: LAP"
  215. matchstr 11 62  "PROTOCOL: MNP"
  216. matchstr 12 62  "PROTOCOL: ALT"
  217. matchstr 13 67  "COMPRESSION: V"
  218. matchstr 14 67  "COMPRESSION: MNP5"
  219. matchstr 15 67  "COMPRESSION: CLASS"
  220. matchread 700
  221. ifANSWER 32
  222. jump 101
  223. !
  224. !  Parse the speed of connect result codes
  225. !  2400 and 4800 have two entries each
  226. !  to distinguish them from 24000 and 48000
  227. !
  228. @LABEL 33
  229. matchclr
  230. matchstr  1 40 "2400¥13"
  231. matchstr  2 40 "2400/"
  232. matchstr  3 41 "4800¥13"
  233. matchstr  4 41 "4800/"
  234. matchstr  5 42 "7200"
  235. matchstr  6 43 "9600"
  236. matchstr  7 44 "12000"
  237. matchstr  8 45 "14400"
  238. matchstr  9 46 "16800"
  239. matchstr 10 47 "19200"
  240. matchstr 11 48 "21600"
  241. matchstr 12 49 "24000"
  242. matchstr 13 50 "26400"
  243. matchstr 14 51 "28800"
  244. matchstr 15 52 "31200"
  245. matchstr 16 53 "33600"
  246. matchstr 17 54 "38400"
  247. matchstr 18 55 "48000"
  248. matchstr 19 56 "56000"
  249. matchstr 20 57 "57600"
  250. matchstr 21 58 "64000"
  251. matchread 30
  252. jump 59
  253. !
  254. ! -- Connection rates --
  255. ! CommunicatingAt informs ARA of the raw modem to modem
  256. ! connection speed.
  257. !
  258. @LABEL 40
  259. note "Communicating at 2400 bps." 2
  260. CommunicatingAt 2400
  261. jump 60
  262. !
  263. @LABEL 41
  264. note "Communicating at 4800 bps." 2
  265. CommunicatingAt 4800
  266. jump 60
  267. !
  268. @LABEL 42
  269. note "Communicating at 7200 bps." 2
  270. CommunicatingAt 7200
  271. jump 60
  272. !
  273. @LABEL 43
  274. note "Communicating at 9600 bps." 2
  275. CommunicatingAt 9600
  276. jump 60
  277. !
  278. @LABEL 44
  279. note "Communicating at 12400 bps." 2
  280. CommunicatingAt 12400
  281. jump 60
  282. !
  283. @LABEL 45
  284. note "Communicating at 14400 bps." 2
  285. CommunicatingAt 14400
  286. jump 60
  287. !
  288. @LABEL 46
  289. note "Communicating at 16800 bps." 2
  290. CommunicatingAt 16800
  291. jump 60
  292. !
  293. @LABEL 47
  294. note "Communicating at 19200 bps." 2
  295. CommunicatingAt 19200
  296. jump 60
  297. !
  298. @LABEL 48
  299. note "Communicating at 21600 bps." 2
  300. CommunicatingAt 21600
  301. jump 60
  302. !
  303. @LABEL 49
  304. note "Communicating at 24000 bps." 2
  305. CommunicatingAt 24000
  306. jump 60
  307. !
  308. @LABEL 50
  309. note "Communicating at 26400 bps." 2
  310. CommunicatingAt 26400
  311. jump 60
  312. !
  313. @LABEL 51
  314. note "Communicating at 28800 bps." 2
  315. CommunicatingAt 28800
  316. jump 60
  317. !
  318. @LABEL 52
  319. note "Communicating at 31200 bps." 2
  320. CommunicatingAt 31200
  321. jump 60
  322. !
  323. @LABEL 53
  324. note "Communicating at 33600 bps." 2
  325. CommunicatingAt 33600
  326. jump 60
  327. !
  328. @LABEL 54
  329. note "Communicating at 38400 bps." 2
  330. CommunicatingAt 38400
  331. jump 60
  332. !
  333. @LABEL 55
  334. note "Communicating at 48000 bps." 2
  335. CommunicatingAt 48000
  336. jump 60
  337. !
  338. @LABEL 56
  339. note "Communicating at 56000 bps." 2
  340. CommunicatingAt 56000
  341. jump 60
  342. !
  343. @LABEL 57
  344. note "Communicating at 57600 bps." 2
  345. CommunicatingAt 57600
  346. jump 60
  347. !
  348. @LABEL 58
  349. note "Communicating at 64000 bps." 2
  350. CommunicatingAt 64000
  351. jump 60
  352. !
  353. @LABEL 59
  354. note "Communicating at an unknown rate." 2
  355. jump 60
  356. !
  357. ! Look for reliablilty and compression results 
  358. ! at the end of the connect result.
  359. !
  360. @LABEL 60
  361. matchclr
  362. matchstr  1 63 "LAPM"
  363. matchstr  2 63 "REL4"
  364. matchstr  3 63 "ARQ"
  365. matchstr  4 68 "REL5"
  366. matchstr  5 68 "COMP¥13"
  367. matchstr  6 63 "V42/"
  368. matchstr  7 63 "V42¥13"
  369. matchstr  8 68 "V42BIS"
  370. matchstr  9 68 "V.42bis"
  371. matchstr 10 63 "MNP¥13"
  372. matchstr 11 68 "MNP5"
  373. matchstr 12 70 "¥10"
  374. matchread 30
  375. jump 70
  376.  
  377. ! -- Modem error correction link negotiation --
  378. ! Userhook 2 informs ARA that a modem-to-modem error
  379. ! correcting protocol has been negotiated
  380. !
  381. !
  382. @LABEL 62
  383. note "Modem Reliable Link Established." 2
  384. userhook 2
  385. jump 32
  386. !
  387. @LABEL 63
  388. note "Modem Reliable Link Established." 2
  389. userhook 2
  390. jump 60
  391. !
  392. ! -- Compression negotiation --
  393. ! Userhook 3 informs ARA that a modem-to-modem compression
  394. ! protocol has been negotiated
  395. !
  396. @LABEL 67
  397. note "Modem Compression Established." 2
  398. userhook 3
  399. jump 32
  400. !
  401. @LABEL 68
  402. note "Modem Compression Established." 2
  403. userhook 3
  404. jump 60
  405. !
  406. !
  407. ! -- Normal exit after "CONNECT" --
  408. !
  409. !  This modem has been setup to do CTS handshaking,
  410. !  and we assume that a CTS handshaking cable is being used.
  411. !
  412. @LABEL 70
  413. ! Turn on CTS handshaking.
  414. HSReset 0 1 0 0 0 0
  415. !
  416. ifANSWER 71
  417. pause 30
  418. @LABEL 71
  419. exit 0
  420. !
  421. !
  422. ! ---- Answer calls ----
  423. !
  424. !    A RING result from the modem and in ANSWERING mode
  425. !    claims the serial port and answering the phone
  426. !
  427. @LABEL 81
  428. ifORIGINATE 32
  429. userhook 1
  430. note "Answering phone..." 2
  431. write "ATA¥13"
  432. jump 32
  433. !
  434. !
  435. ! ---- Hang up and reset modem ----
  436. !
  437. @HANGUP
  438. @LABEL 90
  439. settries 0
  440. HSReset 0 0 0 0 0 0
  441. !
  442. @LABEL 92
  443. !  Escape from data to command mode
  444. matchclr
  445. matchstr 1 96 "OK¥13¥10"
  446. write "+++"
  447. matchread 20
  448. !
  449. @LABEL 94
  450. ! Force a hangup
  451. matchclr
  452. matchstr 1 98 "NO CARRIER¥13¥10"
  453. matchstr 2 98 "OK¥13¥10"
  454. matchstr 3 98 "ERROR¥13¥10"
  455. matchstr 4 98 "0¥13¥10"
  456. write "ATH¥13"
  457. matchread 30
  458. ! Try to get control of the modem by toggling DTR
  459. DTRClear
  460. pause 5
  461. DTRSet
  462. flush
  463. !
  464. ! Try the hangup sequence three times otherwise declare and error
  465. inctries
  466. iftries 3 101
  467. jump 92
  468. !
  469. @LABEL 96
  470. ! Pause between data and command mode
  471. pause 50
  472. jump 94
  473. !
  474. !
  475. @LABEL 98
  476. ! Recall the factory settings
  477. pause 15
  478. matchclr
  479. matchstr 1 99 "OK¥13¥10"
  480. write "AT¥13"
  481. matchread 30
  482. jump 101
  483. !
  484. @LABEL 99
  485. exit 0
  486. !
  487. ! ---- Error messages -----
  488. !
  489. ! Modem Not Responding
  490. @LABEL 101
  491. exit -6019
  492. !
  493. ! No Dial Tone
  494. @LABEL 102
  495. exit -6020
  496. !
  497. ! No Carrier or Error
  498. @LABEL 103
  499. exit -6021
  500. !
  501. ! Busy
  502. @LABEL 104
  503. exit -6022
  504. !
  505. ! No Answer
  506. @LABEL 105
  507. exit -6023
  508. !
  509. ! User Cancellation
  510. @LABEL 107
  511. exit -6002 "User cancelled the connection attempt."